Ext.define('truckplanner.view.yard.List' ,{
    	
	extend: 'Ext.grid.Panel',
	alias : 'widget.yardlist',
    
	title : 'Liste des chantiers',

    dockedItems: [{
		xtype: 'toolbar',
		items: [{
			text: 'Ajouter...',
			action: 'add'
		},{
			text: 'Editer...',
			disabled: true,
			action: 'edit'
		},{
			text: 'Supprimer',
			disabled: true,
			action: 'remove'
		}
		]
	}],

	store : 'Yards',
	
	columns : [
				{header: 'Titre',  dataIndex: 'title',  flex : 2},
				{header: 'NOM',  dataIndex: 'name',  flex: 2},
				{header: 'CP client',  dataIndex: 'zip_home',  flex: 2},
				{header: 'Commune client',  dataIndex: 'city_home',  flex: 2},
				{header: 'adresse client',  dataIndex: 'add_home',  flex: 2},
				{header: 'CP chantier',  dataIndex: 'zip_yard',  flex: 2},
				{header: 'Commune chantier',  dataIndex: 'city_yard',  flex: 2},
				{header: 'adresse chantier',  dataIndex: 'add_yard',  flex: 2},
				{header: 'tél. privé',  dataIndex: 'tel',  flex: 1},
				{header: 'GSM monsieur',  dataIndex: 'gsm_m',  flex: 1},
				{header: 'GSM madame',  dataIndex: 'gsm_f',  flex: 1},
				{header: 'fax privé',  dataIndex: 'fax',  flex: 1},
				{header: 'tél. bureau M.',  dataIndex: 'tel_prof',  flex: 1},
				{header: 'fax. bureau M.',  dataIndex: 'fax_prof',  flex: 1},
				{header: 'tél. bureau Mme',  dataIndex: 'tel_f',  flex: 1},
				{header: 'fax bureau Mme',  dataIndex: 'fax_f',  flex: 1},
				{header: 'adresse mail',  dataIndex: 'email',  flex: 1},
				{header: 'liens',  dataIndex: 'link',  flex: 1},
				{header: 'Nom du Conducteur',  dataIndex: 'foreman',  flex: 1},
				{header: 'Architecte',  dataIndex: 'architect',  flex: 1},
				{header: 'équipe GO',  dataIndex: 'team_go',  flex: 1}
	        ],
	        listeners: {
	    	    selectionchange: function(selmode, selection) {
	    						        var selected = selection[0],
	    						            button = this.down('button[action=remove]'),
	    						            button1 = this.down('button[action=edit]');
	    						        if (selected) {
	    						            button.enable();
	    						            button1.enable();
	    						        }
	    						        else {
	    						            button.disable();
	    						            button1.disable();
	    						        }
	    							}
	    	}
});